# -*- coding:utf-8 -*-


from django.db import models

from Apps.common.custommodel import CustomModel
from Apps.user.models import User


class InterfaceCat(CustomModel):
    category_name = models.CharField(null=True, blank=True, max_length=30, verbose_name="分类名")
    parent = models.CharField(null=True, blank=True, max_length=50, default="", verbose_name="上级部门", )
    index_num = models.IntegerField(verbose_name="排序,前端传值顺序")
    project = models.ForeignKey(to='Project.project', on_delete=models.DO_NOTHING, default="",
                                related_name="InterfaceCat_project",
                                verbose_name="项目外键",
                                db_constraint=False, )

    creator = models.ForeignKey(User, on_delete=models.DO_NOTHING, default="",
                                related_name="user_InterfaceCat_c",
                                verbose_name="创建人")
    modifier = models.ForeignKey(User, on_delete=models.DO_NOTHING, default="",
                                 related_name="user_InterfaceCat_m",
                                 verbose_name="修改人")

    class Meta:
        db_table = "interface_category"
        verbose_name = "分类表"
        ordering = ('index_num', '-create_time',)

    def __str__(self):
        return self.category_name
